package com.firefly.curve.curve;

import java.awt.Color;
import java.awt.Graphics;

import com.firefly.curve.CurvePanel;
import com.firefly.curve.listener.CurveListener;

public class CurveLines implements CurveListener{
	private float[] data=null;
	private Color color=Color.red;
	public Color getColor() {
		return color;
	}
	public void setColor(Color color) {
		this.color = color;
	}
	public float[] getData() {
		return data;
	}
	public void setData(float[] data) {
		this.data = data;
	}
	@Override
	public void draw(CurvePanel cp,Graphics g) {
		if(data!=null){
        	g.setColor(color);//当前画笔颜色
        	
        	for(int i=1;i<data.length;i++){
        		cp.drawLine(i-1,data[i-1],i,data[i]);//画线条
        	}
        } 
	}

}
